<!DOCTYPE html>
<html>
<head>
    <title><%= @title || 'Feedbin' %><%= branch_info if Rails.env.development? %></title>
    <meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no,viewport-fit=cover" />
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <link rel="manifest" href="<%= manifest_path(current_user&.theme.present? ? current_user.theme : "day") %>">
    <link rel="apple-touch-icon" href="<%= asset_path('icon-manifest.png') %>" sizes="192x192" />
    <link rel="shortcut icon" href="<%= asset_path('favicon.ico') %>" type="image/vnd.microsoft.icon" />
    <%= stylesheet_link_tag "tailwind" %>
    <%= stylesheet_link_tag "application", media: "all"  %>
    <style>
        @supports (padding-bottom: max(0px)) {
            .bottom-toolbar, .entries-column .bottom-toolbar {
                padding-bottom: max(20px, env(safe-area-inset-bottom));
            }
            .entries-column .bottom-toolbar {
                padding-bottom: max(8px, env(safe-area-inset-bottom));
            }
            .entry-column .bottom-toolbar {
                padding-bottom: max(0px, env(safe-area-inset-bottom));
            }
        }
    </style>
    <%= javascript_include_tag "lib/lib"  %>
    <%= javascript_include_tag "web" %>
    <%= javascript_importmap_tags %>
    <% if current_user %>
        <% present current_user do |user_presenter| %>
            <script>
                feedbin.theme = "<%= user_presenter.theme %>";
            </script>
        <% end %>
    <% end %>
    <% if native? %>
        <%= javascript_include_tag "lib/turbolinks"  %>
        <script>
            feedbin.native = true
        </script>
    <% end %>
    <script>
        if ("serviceWorker" in navigator) {
            navigator.serviceWorker.register("<%= service_worker_path(format: :js) %>");
        }
        <%# // for :active styles on iOS %>
        document.addEventListener("touchstart", function() {}, false);
    </script>
    <%= yield(:head) %>
    <%= csrf_meta_tags %>
    <%= tag :meta, name: "stripe-key", content: STRIPE_PUBLIC_KEY %>
</head>
<%= tag.body(class: [@class, "group/body", { native: native?, "standalone-navigator" => native?, "native-platform-#{native_platform}" => native_platform }], data: { behavior: @behavior, controller: "visual-viewport", visual_viewport_offset_value: 0 }) do %>
    <%= content_for?(:content) ? yield(:content) : yield %>
    <%= render partial: "shared/theme_colors" %>
<% end %>
</html>
